const express = require('express');
const session = require('express-session');
const { resolve } = require('path');
const ejs = require('ejs');

const r1 = require('./router/apirouter')
const r2 = require('./router/pagerouter')
const r3 = require('./router/loginrouter')

const app = express();
app.engine('html', ejs.renderFile)
app.use(express.static(resolve(__dirname + '/public')));
app.use(express.urlencoded({ extended: false }));
app.use(session({
    name: 'sid',
    resave: true,
    secret: "CD0417",
    cookie: {
        httpOnly: true,
        maxAge: 1000 * 60 * 60
    }

}))
app.listen(88, () => {
    console.log('listening')
})

// 写入路由
app.use(r1)
app.use(r2)
app.use(r3)





